﻿using System;

using DevExpress.Xpo;

using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using System.ComponentModel;
using DevExpress.ExpressApp;
using DevExpress.Data.Filtering;

namespace SpeedSCM.Module
{
   [NavigationItem("资金管理")]
    [ImageName("BO_Sale_v92")]
    public class 一般费用单 : 单据
    {
        public 一般费用单(Session session)
            : base(session)
        {

        }
        protected override SeedType SeedType
        {
            get { return SeedType.一般费用单; }
        }

        private 往来单位 _收费单位;
        [Custom("Caption", "收费单位")]
        [RuleRequiredField(null,DefaultContexts.Save,"必须选择收费单位")]
        public 往来单位 收费单位
        {
            get { return _收费单位; }
            set { SetPropertyValue<往来单位>("收费单位", ref _收费单位, value); }
        }

        private 银行账户 _付款账户;
        [Custom("Caption", "付款账户")]
        [RuleRequiredField(null,DefaultContexts.Save,"必须选择付款账户")]
        public 银行账户 付款账户
        {
            get { return _付款账户; }
            set { SetPropertyValue<银行账户>("付款账户", ref _付款账户, value); }
        }
        private decimal _实付金额;
        [Custom("Caption", "实付金额")]
        [RuleRequiredField]
        public decimal 实付金额
        {
            get { return _实付金额; }
            set { SetPropertyValue<decimal>("实付金额", ref _实付金额, value); }
        }

        [Association("一般费用单-明细")]
        public XPCollection<一般费用单明细> 一般费用单明细
        {
            get { return GetCollection<一般费用单明细>("一般费用单明细"); }
        }
    }

   [ImageName("BO_Sale_v92")]
   [RuleCombinationOfPropertiesIsUnique(null, DefaultContexts.Save, "一般费用单,费用类型", CustomMessageTemplate = "一般费用单中已经存在该费用类型")]
   public class 一般费用单明细 : BaseObject
   {
       public 一般费用单明细(Session session)
           : base(session)
       {

       }
       private 一般费用单 _一般费用单;
       [Custom("Caption", "一般费用单")]
       [Association("一般费用单-明细")]
       [Custom("AllowEdit", "False")]
       public 一般费用单 一般费用单
       {
           get { return _一般费用单; }
           set { SetPropertyValue<一般费用单>("一般费用单", ref _一般费用单, value); }
       }
       private 费用类型 _费用类型;
       [Custom("Caption", "费用类型")]
       [RuleRequiredField(null, DefaultContexts.Save, "必须选择费用类型")]
       public 费用类型 费用类型
       {
           get { return _费用类型; }
           set { SetPropertyValue<费用类型>("费用类型", ref _费用类型, value); }
       }
       private decimal _金额;
       [Custom("Caption", "金额")]
       [RuleRequiredField]
       public decimal 金额
       {
           get { return _金额; }
           set { SetPropertyValue<decimal>("金额", ref _金额, value); }
       }
       private string _备注;
       [Custom("Caption", "备注")]
       [Size(500)]
       public string 备注
       {
           get { return _备注; }
           set { SetPropertyValue<string>("备注", ref _备注, value); }
       }
   }
}
